/*
 * @Descripttion:
 * @Author: 王小杰
 * @Date: 2019-12-04 21:31:51
 * @LastEditors  : QiangWei
 * @LastEditTime : 2020-01-14 18:13:14
 */

import Vue from 'vue';
import Router from 'vue-router';
// import Layout from '@/views/Layout.vue';

Vue.use(Router);

let router!: any;
const Layout = () => import(/* webpackChunkName: 'bind' */ '@/views/Layout.vue');

router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    { path: '/', name: 'home', meta: {title: '', requireAuth: false}, redirect: '/index' },
    {
      path: '/index',
      name: 'layout',
      meta: {title: '', requireAuth: false },
      component: Layout,
      children: []
    }
  ]
});
router.beforeEach(async (to: any, from: any, next: any) => {
  /* 路由发生变化修改页面title */
  if (to.meta) {
    document.title = to.meta.title;
  }
  next();
});
export default router;
